package com.cssy.xxkj.logic.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cssy.xxkj.logic.dao.LogicAllocatOutwhDAO;
import com.cssy.xxkj.logic.dao.LogicProductionStorageoutDAO;
import com.cssy.xxkj.logic.dao.LogicPurchaseDAO;
import com.cssy.xxkj.logic.dao.LogicPurchaseReturnDAO;
import com.cssy.xxkj.logic.dao.LogicPurchaseWareDAO;
import com.cssy.xxkj.logic.dao.LogicSalesDAO;
import com.cssy.xxkj.logic.dao.LogicWarehousePriceDAO;
import com.cssy.xxkj.logic.entity.LogicAllocatOutwhDO;
import com.cssy.xxkj.logic.entity.LogicProductionStorageoutDO;
import com.cssy.xxkj.logic.entity.LogicPurchaseDO;
import com.cssy.xxkj.logic.entity.LogicPurchaseReturnDO;
import com.cssy.xxkj.logic.entity.LogicPurchaseWareDO;
import com.cssy.xxkj.logic.entity.LogicSalesDO;
import com.cssy.xxkj.logic.entity.LogicWarehousePriceDO;
import com.cssy.xxkj.logic.service.ILogicUtilService;
import com.plat.exception.SyBaseException;
import com.plat.helper.SearchConditions;
import com.plat.util.GlobalResLoader;

@Service("logicUtilService")
public class LogicUtilServiceImpl implements ILogicUtilService {
	
	//销售订单DAO
	@Resource(name="logicSalesDAO")	
	private LogicSalesDAO logicSalesDAO;
	
	//生产出库DAO
	@Resource(name="logicProductionStorageoutDAO")	
	private LogicProductionStorageoutDAO logicProductionStorageoutDAO;

	//采购订单DAO
	@Resource(name="logicPurchaseDAO")	
	private LogicPurchaseDAO logicPurchaseDAO;
	
	//采购入库单DAO
	@Resource(name="logicPurchaseWareDAO")
	private LogicPurchaseWareDAO logicPurchaseWareDAO;
	
	//采购退货单DAO
	@Resource(name="logicPurchaseReturnDAO")
	private LogicPurchaseReturnDAO logicPurchaseReturnDAO;
	
	//调拨发起单
	@Resource(name="logicAllocatOutwhDAO")
	private LogicAllocatOutwhDAO logicAllocatOutwhDAO;
	
	//调拨发起单
	@Resource(name="logicWarehousePriceDAO")
	private LogicWarehousePriceDAO logicWarehousePriceDAO;
	
	@Override
	public List<LogicSalesDO> resultSales(SearchConditions scs)throws SyBaseException{
		return logicSalesDAO.find(scs);
	}
	
	@Override
	public List<LogicProductionStorageoutDO> resultStagout(SearchConditions scs)throws SyBaseException{
		return logicProductionStorageoutDAO.find(scs);
	}
	
	@Override
	public List<LogicPurchaseDO> resultPurchase(SearchConditions scs)throws SyBaseException{
		try{
			return logicPurchaseDAO.find(scs);
		}catch(Exception e){
			e.printStackTrace();
			throw new SyBaseException(GlobalResLoader.getOpfailed()+ e.getMessage());
		}
	}

	@Override
	public List<LogicPurchaseWareDO> resultPurchaseWare(SearchConditions scs)throws SyBaseException {
		try{
			return logicPurchaseWareDAO.find(scs);
		}catch(Exception e){
			e.printStackTrace();
			throw new SyBaseException(GlobalResLoader.getOpfailed()+ e.getMessage());
		}
	}
	
	@Override
	public List<LogicPurchaseReturnDO> resultPurchaseReturn(SearchConditions scs)throws SyBaseException {
		try{
			return logicPurchaseReturnDAO.find(scs);
		}catch(Exception e){
			e.printStackTrace();
			throw new SyBaseException(GlobalResLoader.getOpfailed()+ e.getMessage());
		}
	}
	
	@Override
	public List<LogicAllocatOutwhDO> resultAlloactOutwh(SearchConditions scs)throws SyBaseException{
		try{
			return logicAllocatOutwhDAO.find(scs);
		}catch(Exception e){
			e.printStackTrace();
			throw new SyBaseException(GlobalResLoader.getOpfailed()+ e.getMessage());
		}
	}
	
	@Override
	public List<LogicWarehousePriceDO> resultWhPrice(SearchConditions scs)throws SyBaseException{
		try{
			return logicWarehousePriceDAO.find(scs);
		}catch(Exception e){
			e.printStackTrace();
			throw new SyBaseException(GlobalResLoader.getOpfailed()+ e.getMessage());
		}
	}
}
